<?php


// no direct access
defined('_JEXEC') or die('Restricted access');


class WbdatabasesControllerWbdatabase extends WbdatabasesController
{
  function __construct() 
  {
    parent::__construct();
    $this->registerTask('add', 'edit');
  }
  function edit()
  {
    JRequest::setVar( 'view', 'wbdatabase' );
    JRequest::setVar( 'layout', 'form'  );
    JRequest::setVar('hidemainmenu', 1);
 
    parent::display();
  }
  
  function save()
  {
    $model = $this->getModel('wbdatabase');
    
    if ($model->store())
    {
      $msg = JText::_('Record saved');
    }
    else
    {
      $msg = JText::_('Error saving record');
    }

    $link = 'index.php?option=com_wbdatabase';
    $this->setRedirect($link, $msg);
  }
  
  function remove()
  {
    $model = $this->getModel('wbdatabase');
    if ($model->delete())
    {
      $msg = JText::_('Record deleted');
    }
    else
    {
      $msg = JText::_('Error deleting record');
    }
    $link = 'index.php?option=com_wbdatabase';
    $this->setRedirect($link, $msg);
}

  function cancel()
  {
    $msg = JText::_('Operation cancelled');
    $link = 'index.php?option=com_wbdatabase';
    $this->setRedirect($link, $msg);
  }

}

?>
